import { NgModule } from '@angular/core';
import { RouterModule, NavigationEnd, Router } from '@angular/router';
import { LibraryComponent } from './library/library.component';
import { StatisticsComponent } from './statistics/statistics.component';
import { ReportMonthComponent } from './report-month/report-month.component';

@NgModule({
    imports: [
        RouterModule.forChild([
            {
                path: '',
                children: [
                    { path: 'library', component: LibraryComponent , data: { permission: 'Pages.Administration.Users' } },
                    { path: 'statistics', component: StatisticsComponent , data: { permission: 'Pages.Administration.Users' } },
                    { path: 'report-month', component: ReportMonthComponent , data: { permission: 'Pages.Administration.Users' } }
                ]
            }
        ])
    ],
    exports: [RouterModule]
})
export class LaborHourRoutingModule {
    constructor(private router: Router) {
        router.events.subscribe(event => {
            if (event instanceof NavigationEnd) {
                window.scroll(0, 0);
            }
        });
    }
}
